home *** CD-ROM | disk | FTP | other *** search
- /****i* SOURCE_FILE/INFO
- *
- * NAME
- * ControlPanelWindow.js
- *
- * USAGE
- * Part of Netobjects JavaScript Library.
- *
- * COPYRIGHT
- * Copyright ⌐ 2002-2004 Website Pros, Inc.
- * All Rights Reserved.
- *
- * This is an unpublished work protected by Website Pros, Inc.
- * as a trade secret, and is not to be used or disclosed except as
- * expressly provided in a written license agreement executed by
- * you and Website Pros, Inc.
- *
- * <copyright@websitepros.com>
- *
- * NOTES
- * JavaScript code.
- *****/
- if (!IS_isModuleInitialized("IS.NOF.CONTROLPANEL.HTML.ControlPanelWindow"))
- {
- function NOF_ControlPanelWindow(_editedElement, _document, _name) {
- this.__proto__ = NOF_ControlPanelWindow.prototype;
-
- if (arguments.length == 0 )
- this.SUPER();
- else {
- this.SUPER(_editedElement, _document, _name);
- }
-
- this.defaultName = "ControlPanelWindow";
-
- this.Log = NOF.UTIL.LOGGING.getLogger("CPanelWindow");
- //if (qLog.getHandlers().length && qLog.getHandlers()) {
- this.Log.setLevel(NOF.UTIL.LOGGING.Level.CONFIG);
- //this.Log.addHandler(new NOF.UTIL.LOGGING.ConsoleHandler(this.Log));
- //}
-
- }
-
- NOF_ControlPanelWindow.inherits(NOF.HTML.EditorWindow);function NOF_ControlPanelWindowProtoBuilder() {
- var member = NOF_ControlPanelWindow.prototype;
-
- member.onInit = onInit;
- member.postRequest = postRequest;
- member.forward = forward;
- member.windowLauncher = windowLauncher;
- member.initOfflineMode = initOfflineMode;
- member.doLoginFromOfflineMode = doLoginFromOfflineMode;
- member.doStartNewAccount = doStartNewAccount;
- member.doStartForgotPassword = doStartForgotPassword;
- member.displayOfflineCPPage = displayOfflineCPPage;
- member.loginAfterSignUp = loginAfterSignUp;
-
- function onInit() {
- this.Log.info("ready to forward to " + this.editedElement.getOfflineURL(), this.defaultName, "onInit");
- this.forward( this.editedElement.getOfflineURL() );
- }
-
-
- function postRequest(url) {
- //NOF.util_logging_ConsoleLogger_global.info("POST REQUEST = " + url)
- try {
- this.Log.info(url, "ControlPanelWindow", "postRequest");
-
- if ( parent.frames[1].document == null || !parent.frames[1].document )
- return;
-
- var statusDialog = new NOF.DIALOGS.StatusDlg();
- statusDialog.hide(); //this.getApp().getFSIApp2().SetShowStatusDialog(false);
-
- if(this.getDoc().getElementById("waitLayer"))
- this.getDoc().getElementById("waitLayer").style.visibility = "visible";
-
- var req = new NOF.NET.HttpRequest(url);
- req.setMethod("POST");
- //req.setIncludeHeaderResult(false);
- //req.setIncludeBodyResult(true);
- var httpObj = new NOF.NET.Http(req);
- var resp = httpObj.open();
- var redirect = resp.getContent();
- req = null;
- httpObj = null;
- //var redirect = this.getApp().getFSIApp2().HttpRequest2(url , '','', false, false, true);
-
- this.Log.info(redirect, "ControlPanelWindow", "postRequest");
- //NOF.UTIL.LOGGING.getLogger("CPanelLog").info(redirect, "ControlPanelWindow", "postRequest");
-
- if(parent.frames[1].document.getElementById("waitLayer"))
- parent.frames[1].document.getElementById("waitLayer").style.visibility = "hidden";
-
- parent.frames[1].document.write(redirect);
- //statusDialog.hide(); //?
- statusDialog = null;
- } catch(e){}
-
-
- }
-
-
- function forward(url) {
- parent.frames[1].location = url;
- }
-
-
-
- function windowLauncher(url, width, height) {
- width = ( arguments.length > 1) ? width : 700;
- height = ( arguments.length > 2) ? height : 650;
-
- NOF.DIALOGS.BrowserDlg.openBrowser(url, '', width, height, false);
- //this.getApp().getFSIApp2().BrowserNoCtrl(url, '', width, height);
- }
-
-
-
- function initOfflineMode() {
- try {
- //NOF.util_logging_ConsoleLogger_global.info("Start INIT_OFFLINE_MODE")
- this.getDoc().initialize(this);
- this.getDoc().setElementValue("cp.offline.label.error.online", "");
-
- this.getDoc().getElementById("loginButton").disabled = true;
- if (this.getDoc().getElementById("signUp"))
- this.getDoc().getElementById("signUp").disabled = true;
-
- var autoLogin = NOF.App.getVariable("controlPanelAutoLogin"); //var autoLogin = this.getApp().getFSIApp().GetSystemVar("controlPanelAutoLogin");
- if (autoLogin == "")
- this.getDoc().getElementById("autoLogin").checked = true;
- else
- this.getDoc().getElementById("autoLogin").checked = autoLogin.toLowerCase() == "true";
-
- var onlineMode = this.editedElement.isOnline();
- if( onlineMode == 0 ) {
- this.postRequest( this.editedElement.getOnlineURL() );
- //NOF.util_logging_ConsoleLogger_global.info("End ON_INIT - w/ POST_REQUEST")
- return;
- }
- if(this.getDoc().getElementById("waitLayer"))
- this.getDoc().getElementById("waitLayer").style.visibility = "hidden";
-
- this.getDoc().getElementById("loginButton").disabled = false;
- if (this.getDoc().getElementById("signUp"))
- this.getDoc().getElementById("signUp").disabled = false;
-
- } catch (e) {
- return null;
- }
- }
-
-
-
- function doLoginFromOfflineMode(userName, password) {
- var onLineMode = this.editedElement.isOnline();
- this.Log.info("online mode = " + onLineMode + ". Start Login from Offline mode , username = " + userName, "ControlPanelWindow", "postRequest");
- //NOF.util_logging_ConsoleLogger_global.info("Start Login from Offline mode , username = " + userName);
-
- var autoLogin = this.getDoc().getElementById("autoLogin").checked;
- NOF.App.setVariable("controlPanelAutoLogin", autoLogin); //this.getApp().getFSIApp().SetSystemVar("controlPanelAutoLogin", autoLogin);
-
- if ( onLineMode == 0 ) {
- //this.displayOfflineCPPage();
- this.postRequest( this.editedElement.getOnlineURL(userName, password, false) );
- } else
- this.displayOfflineCPPage();
-
- //NOF.util_logging_ConsoleLogger_global.info("End Login from Offline mode , username = " + userName);
- }
-
- function doStartNewAccount() {
- var onLineMode = this.editedElement.isOnline();
-
- //NOF.util_logging_ConsoleLogger_global.info(this.defaultName + " New Account from Offline mode ");
-
- if ( onLineMode == 0 ) {
- this.getDoc().setElementValue("cp.offline.label.error.online", "");
- this.windowLauncher( this.editedElement.getOnlineNewAccountURL() );
-
- //after new account is over try to launch online login
- this.onInit();
- } else
- this.displayOfflineCPPage();
- }
-
- function doStartForgotPassword() {
- var onLineMode = this.editedElement.isOnline();
-
- //NOF.util_logging_ConsoleLogger_global.info(this.defaultName + " Start 'Forgot Password' dialog from Offline mode ");
-
- if ( onLineMode == 0 ) {
- this.getDoc().setElementValue("cp.offline.label.error.online", "");
- this.windowLauncher( this.editedElement.getForgotPasswordURL() );
- this.getDoc().doc.getElementById("cp.offline.image.error.notOline").src = this.getResourceProperty("cp.offline.image.error.online");
- } else
- this.displayOfflineCPPage();
- }
-
- function displayOfflineCPPage() {
- this.getDoc().setElementValue("cp.offline.label.error.online", this.getResourceProperty("cp.offline.label.error.online"));
- this.getDoc().doc.getElementById("cp.offline.image.error.notOline").src = this.getResourceProperty("cp.offline.image.error.notOline");
- }
-
- function loginAfterSignUp() {
- /*
- var nofReg = new NOF.NOFSettings();
- var loc = "file:///";
- //loc += this.getApp().getFSIApp().GetRegistryString(true, "InstallPath");
- loc += nofReg.get('InstallPath', NOF.NOFSettings.STRING_VALUE);
- nofReg = null;
- loc +="/NetObjects System/online/" + NOF.App.getDefaultLocale().getLanguage() + "/controlPanel/controlPanel_loginOffline.html";
- //NOF.util_logging_ConsoleLogger_global.info("LOCATION = " + loc);
- nofReg = null;
- parent.frames[1].location = loc;
- */
- parent.frames[1].location = NOF.App.getSystemDirectory() + "/Online/" + NOF.App.getDefaultLocale().getLanguage() + "/controlPanel/controlPanel_loginOffline.html";
- }
- }
-
- NOF_ControlPanelWindowProtoBuilder();
- NOF.CONTROLPANEL.HTML.__proto__.ControlPanelWindow = NOF_ControlPanelWindow;
- }